package day5;
import java.util.Scanner;
public class D5_6 {
    public static void main(String[] args) {
        Scanner a=new Scanner(System.in);
        String[]name=new String[3];
        int []price=new int[3];
        int []qulities=new int[3];
        int []amount=new int[3];
        int totalqulities=0;
        int totalamount=0;
        for (int i=0;i<3;i++){
            System.out.println("请输入第"+(i+1)+"件商品的名称：");
            name[i]=a.nextLine();
            System.out.println("录入成功！");
            System.out.println("请输入第"+(i+1)+"件商品的数量：");
            qulities[i]=a.nextInt();
            System.out.println("录入成功！");
            System.out.println("请输入第"+(i+1)+"件商品的单价：");
            price[i]=a.nextInt();
            System.out.println("录入成功!");
            a.nextLine();
            amount[i]=price[i]*qulities[i];
            System.out.println("第"+(i+1)+"件商品录入成功！");
        }
        System.out.println("-------------------------------");
        System.out.printf("-12%s\t%6d\t%8\t%10\n","商品名称","数量","单价","金额");
        for (int i=0;i<3;i++){
            System.out.printf("-12%s\t%6d\t%8\t%10\n",name[i],qulities[i],price[i],amount[i]);
            totalqulities+=qulities[i];
            totalamount+=amount[i];
        }
        System.out.println("-------------------------------");
        System.out.println("总数量:"+totalqulities);
        System.out.println("总金额："+totalamount);
        System.out.println("优惠金额：0");
        System.out.println("实付金额："+totalamount);
    }
}
